package com.demo.javaee.project.json.model;

import lombok.*;

import javax.json.bind.annotation.JsonbDateFormat;
import javax.json.bind.annotation.JsonbNumberFormat;
import javax.json.bind.annotation.JsonbProperty;
import javax.json.bind.annotation.JsonbTransient;
import java.math.BigDecimal;
import java.time.LocalDate;

@Data
@AllArgsConstructor
@NoArgsConstructor
public class StudentDTO {

    @JsonbTransient
    private Long id;

    @JsonbProperty("no")
    private String no;

    @JsonbProperty("name")
    private String name;


    @JsonbDateFormat("yyyy-MM-dd")
    private LocalDate birthday;

    @JsonbProperty("tuition")
    private BigDecimal tuition;

    @JsonbNumberFormat(value = "#0.00", locale = "en_US")
    public void setTuition(BigDecimal tuition) {
        this.tuition = tuition;
    }
}
